package com.mijie.keywordCywejon;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.mijie.homi.search.util.fileC0;
import com.mijie.homi.search.util.listUtil;


public class keywordCywejonCls {

	public static void main(String[] args) throws Exception {
		
		keywordCywejonCls c=new keywordCywejonCls();
		c.tonjyiKeywordPinlwAll();
		System.out.println("--f");
		
	}

	private void tonjyiKeywordPinlwAll() {
	 	Map mp=new HashMap<String, Integer>();
		fileC0 fc=new fileC0();
		List<String> fs=	fc.getFilepathsByPrefix("c:\\exp", "filted_keywords_fents");
		for(String filepath:fs)
		{
			List<String> lines=fc.fileRead2list(filepath);
			for(String line:lines)
			{
				String[] a=line.split("\t");
				String kw=a[0];
				
				Integer num=Integer.parseInt(  a[1]);
				if(mp.containsKey(kw))
				{
					Integer num_old=(Integer) mp.get(kw);
					Integer num_new=num_old+num;
					mp.put(kw, num_new);					
				}else
				{
					mp.put(kw, num);
				}				
			}			
		}
		
		//
	List lir=	listUtil.orderByValueIntx(mp);
	
	listUtil.saveListMapStrInt(lir, "c:\\exp\\keywordsPinlwAll.txt");
		
		
		
	}
	
	
}
